<template>
  <div>
    <el-card class="box-card">
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>客户名称:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <el-input v-model="cilentName" placeholder="客户名称"></el-input>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>

      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>负责人:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <el-input v-model="cilentUser" placeholder="负责人"></el-input>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>

      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>负责人电话:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <el-input v-model="cilentPhone" placeholder="负责人电话"></el-input>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>

      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>办公地址:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <el-input v-model="cilentAddress" placeholder="客户办公地址"></el-input>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>

      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>邮箱:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <el-input v-model="cilentEmail" placeholder="客户邮箱"></el-input>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>

      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>经营范围:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <el-input v-model="cilentScope" type="textarea" :rows="3" placeholder="经营范围"></el-input>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>

      <el-button type="success" @click="add">添加</el-button>
    </el-card>

  </div>
</template>

<script>
export default {
  name: "addCilent",
  data() {
    return {
      cilentName: '',
      cilentUser: '',
      cilentPhone: '',
      cilentAddress: '',
      cilentEmail: '',
      cilentScope: ''
    }
  },
  methods: {
    add() {
      if (this.cilentName == '' || this.cilentUser == ''
          || this.cilentPhone == '' || this.cilentAddress == ''
          || this.cilentScope == '') {
        this.$message.error('信息不能有空')
      } else {
        let formData = new FormData()
        formData.append("clientName", this.cilentName)
        formData.append("clientHead", this.cilentUser)
        formData.append("clientPhone", this.cilentPhone)
        formData.append("clientEmail",this.cilentEmail)
        formData.append("clientAddress", this.cilentAddress)
        formData.append("clientScope", this.cilentScope)
        this.$axios.post('drp/cilent/addClient', formData).then(
            r => {
              if (r.data == 'ok') {
                this.$message.success('添加成功')
                location.href = "/index"
              }
            }
        )
      }
    }
  }
}
</script>

<style scoped>

</style>